import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    windowHeight: 0,
	userInfo: {},
	address: {},
	flag: '1234',
	network: 0
  },
  mutations: {
    changeWindowHeight(state, num) {
		state.windowHeight = num;
	},
	changeUserInfo(state, obj) {
		state.userInfo = obj;
	},
	changeUserIDcar(state, str) {
		state.userInfo.user_plate = str;
	},
	changeAddressLng(state, num) {
		state.address.lng = num;
	},
	changeAddressLat(state, num) {
		state.address.lat = num;
	},
	changeAddressCity(state, num) {
		state.address.city = num;
	},
	saveUserInfo(state) {
		uni.setStorageSync('userInfo', JSON.stringify(state.userInfo));
	},
	changeflag(state, val) {
		state.flag = val;
	}
  },
  getters: {
  },
  actions: {},
  modules: {
  }
});